﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Tycho.Peyote.Mock {
    /// <summary>
    /// Interaction logic for List.xaml
    /// </summary>
    public partial class List : GlyphControl {
        private ListItemReorderer ListItemReorderer;

        public List () {
            InitializeComponent ();

            DataContext = this;
            ListItemReorderer = new ListItemReorderer (ItemsStackPanel);
        }

        private void AddItemButton_Click (object sender, RoutedEventArgs e) {
            ItemsStackPanel.Items.Add (new ListItem ("alpha", this, ListItemReorderer));
            e.Handled = true;
        }

        private void ItemsStackPanel_Drop (object sender, DragEventArgs e) {
            Debug.WriteLine ("List.Drop");
            ListItemReorderer.Drop ();
            e.Handled = true;
        }

        public void Remove (ListItem item) {
            ItemsStackPanel.Items.Remove (item);
        }
    }
}
